home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / c / c2man-2.0pl33.lha / c2man-2.0 / Makefile.SH < prev    next >
Encoding:
Makefile  |  1995-01-24  |  4.3 KB  |  171 lines

  1. case $CONFIG in
  2. '')
  3.     if test ! -f config.sh; then
  4.         ln ../config.sh . || \
  5.         ln ../../config.sh . || \
  6.         ln ../../../config.sh . || \
  7.         (echo "Can't find config.sh."; exit 1)
  8.     fi 2>/dev/null
  9.     . ./config.sh
  10.     ;;
  11. esac
  12. : This forces SH files to create target in same directory as SH file.
  13. : This is so that make depend always knows where to find SH derivatives.
  14. case "$0" in
  15. */*) cd `expr X$0 : 'X\(.*\)/'` ;;
  16. esac
  17. echo "Extracting Makefile (with variable substitutions)"
  18. : This section of the file will have variable substitutions done on it.
  19. : Move anything that needs config subs from !NO!SUBS! section to !GROK!THIS!.
  20. : Protect any dollar signs and backticks that you do not want interpreted
  21. : by putting a backslash in front.  You may delete these comments.
  22. $spitshell >Makefile <<!GROK!THIS!
  23. # $Id: Makefile.SH,v 2.0.1.27 1994/09/16 05:51:57 greyham Exp $
  24. #
  25. # UNIX makefile for manual page generator
  26. # Note: any changes made here will be lost next time Configure is run!.
  27.  
  28. CC=$cc $optimize
  29. YACC=$yacc
  30. LEX=$lex
  31. SED=$sed
  32. CAT=$cat
  33. RM=$rm
  34. MV=$mv
  35. CP=$cp
  36. ECHO=$echo
  37. MKDEP=$mkdep
  38.  
  39. # where we get installed
  40. bin=$binexp
  41. privlib=$installprivlib
  42.  
  43. mansrc=$mansrc
  44. manext=$manext
  45. CFLAGS=$ccflags
  46. WARNFLAGS=$warnflags
  47. LDFLAGS=$ldflags
  48. LIBS=$libs $liblex $libyacc
  49. !GROK!THIS!
  50.  
  51. : In the following dollars and backticks do not need the extra backslash.
  52. $spitshell >>Makefile <<'!NO!SUBS!'
  53.  
  54. # As Larry said, "Grrrr"
  55. SHELL=/bin/sh
  56.  
  57. OSOURCES =    config.h c2man.h semantic.h symbol.h strconcat.h \
  58.         strappend.h manpage.h enum.h output.h lex.l grammar.y
  59. DCSOURCES =    c2man.c semantic.c string.c symbol.c strconcat.c \
  60.         strappend.c manpage.c enum.c nroff.c texinfo.c latex.c html.c
  61. SOURCES =    $(OSOURCES) $(DCSOURCES)
  62. CSOURCES =    $(DCSOURCES) y.tab.c
  63. OBJECTS =    c2man.o semantic.o string.o symbol.o y.tab.o strconcat.o \
  64.         strappend.o manpage.o enum.o nroff.o texinfo.o latex.o html.o
  65. GENERATED =    c2man example.inc ctype_ex.inc y.tab.c lex.yy.c y.output \
  66.         fixexamp.sed flatten.sed
  67.  
  68.  
  69. all: c2man c2man.1
  70.  
  71. install: all
  72.     $(CP) c2man $(bin)
  73.     $(CP) c2man.1 $(mansrc)/c2man.$(manext)
  74.     -mkdir $(privlib)
  75.     chmod 755 $(privlib)
  76.     -mkdir $(privlib)/eg
  77.     chmod 755 $(privlib)/eg
  78.     $(CP) eg/*.[chly] $(privlib)/eg
  79.     chmod 755 $(privlib)/eg/*
  80.  
  81. uninstall:
  82.     $(RM) -f $(bin)/c2man $(mansrc)/c2man.$(manext)
  83.     $(RM) -f $(privlib)/eg/*
  84.     rmdir $(privlib)/eg
  85.     rmdir $(privlib)
  86.  
  87. c2man: $(OBJECTS)
  88.     $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJECTS) $(LIBS)
  89.  
  90. c2man.1: c2man.man c2man example.inc ctype_ex.inc flatten.sed
  91.     $(SED) -f flatten.sed < c2man.man > c2man.1
  92.  
  93. .c.o:
  94.     $(CC) $(CFLAGS) $(WARNFLAGS) -c $<
  95.  
  96. y.tab.c: grammar.y
  97.     @$(ECHO) Expect 54 shift/reduce conflicts.
  98.     $(YACC) grammar.y
  99.  
  100. # don't compile y.tab.c with all warnings; yacc/bison are not up to it.
  101. y.tab.o: y.tab.c lex.yy.c
  102.     $(CC) $(CFLAGS) -c y.tab.c
  103.  
  104. lex.yy.c: lex.l
  105.     $(LEX) -n lex.l
  106.  
  107. example.inc: c2man example.h fixexamp.sed
  108.     ./c2man -o- example.h | $(SED) -f fixexamp.sed >example.inc
  109.  
  110. ctype_ex.inc: c2man ctype_ex.h fixexamp.sed
  111.     ./c2man -o- -g ctype_ex.h | $(SED) -f fixexamp.sed >ctype_ex.inc
  112.  
  113. fixexamp.sed: fixexamp.in
  114.     $(SED) -e '/^#/d' fixexamp.in > fixexamp.sed
  115.  
  116. flatten.sed: flatten.SH config.sh
  117.     sh flatten.SH
  118.  
  119. Makefile: Makefile.SH config.sh
  120.     sh Makefile.SH
  121.  
  122. config.h: config_h.SH config.sh
  123.     sh config_h.SH
  124.  
  125. TAGS: $(SOURCES)
  126.     etags -t $(SOURCES)
  127.  
  128. clean:
  129.     $(RM) -f *.o *.s *.bak *~ *.log $(GENERATED) core
  130.  
  131. distclean realclean: clean
  132.     $(RM) -f Makefile config.sh mkdep c2man.kit?
  133.  
  134. lint:
  135.     lint -b $(CFLAGS) $(CSOURCES)
  136.  
  137. print:
  138.     cpr $(SOURCES) | lpr -J'c2man'
  139.  
  140. test: c2man
  141.     @echo "Running c2man over the examples..." 1>&2
  142.     @for file in eg/*.[chly]; do ./c2man -v -o- $$file; done
  143.     @echo "Running c2man over its own source code..." 1>&2
  144.     @for file in $(DCSOURCES); do ./c2man -v -o- $$file; done
  145.     @echo "Hmmm, test seemed to go OK." 1>&2
  146.  
  147. depend:
  148.     $(SED) -e '1,/^# DO NOT/!d' < Makefile > Makefile.new
  149.     $(MKDEP) $(DCSOURCES) >> Makefile.new
  150.     - test ! -f y.tab.c -o ! -f lex.yy.c || $(MKDEP) y.tab.c >> Makefile.new
  151.     $(MV) -f Makefile.new Makefile
  152.  
  153. # y.tab.c dependancies updated manually since it won't exist yet when make
  154. # depend is first run.
  155. y.tab.o: c2man.h
  156. y.tab.o: config.h
  157. y.tab.o: confmagic.h
  158. y.tab.o: enum.h
  159. y.tab.o: manpage.h
  160. y.tab.o: semantic.h
  161. y.tab.o: strappend.h
  162. y.tab.o: strconcat.h
  163. y.tab.o: symbol.h
  164.  
  165. # DO NOT DELETE THIS LINE! make depend DEPENDS ON IT!
  166. c2man.o:
  167.     @echo "You must run a make depend first."; exit 1
  168. !NO!SUBS!
  169. chmod 755 Makefile
  170. $eunicefix Makefile
  171.